VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H80000003&
   Caption         =   "Form1"
   ClientHeight    =   3495
   ClientLeft      =   7320
   ClientTop       =   3480
   ClientWidth     =   6705
   LinkTopic       =   "Form1"
   ScaleHeight     =   3495
   ScaleWidth      =   6705
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000003&
      Caption         =   "ตกลง"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2040
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   2400
      Width           =   1575
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H80000003&
      Caption         =   "ยกเลิก"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   4080
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2400
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H80000003&
      Caption         =   "กรุณาใส่ข้อมูลเพื่อเข้าสู่ระบบ"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   222
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2775
      Left            =   240
      TabIndex        =   2
      Top             =   480
      Width           =   6255
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   14.25
            Charset         =   222
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1800
         TabIndex        =   4
         Top             =   600
         Width           =   3615
      End
      Begin VB.TextBox Text2 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   14.25
            Charset         =   222
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1800
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   1320
         Width           =   3615
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H80000003&
         Caption         =   "ชื่อผู้ใช้"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   222
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   480
         TabIndex        =   6
         Top             =   720
         Width           =   630
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H80000003&
         Caption         =   "รหัสผ่าน"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   222
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   480
         TabIndex        =   5
         Top             =   1440
         Width           =   735
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n As Integer
Dim x As Integer
Private Sub Command1_Click()
n = n + 1
If Text1 = "" Then
MsgBox "กรุณากรอกข้อมูลผู้ใช้", vbOKOnly, "ผิดพลาด"
ElseIf Text2 = "" Then
MsgBox "กรุณากรอกรหัสผ่าน", vbOKOnly, "ผิดพลาด"
ElseIf Text1 = "1" And Text2 = "1" Then
MsgBox "ยินดีต้อนรับ คุณ " & Text1 & "", vbOKOnly, "Login..."
Form1.Hide
Form2.Show
Else
   x = MsgBox(" รหัสผ่านไม่ถูกต้อง" & Chr(13) & " คุณต้องการป้อนรหัสผ่านอีกครั้งหรือไม่", 5, "Answer")
    If n < 3 And (x = 4) Then
         Text1.Text = ""
         Text2.Text = ""
         Text1.SetFocus
         ElseIf x = 2 Then
         End
      Else
         MsgBox "คุณป้อนรหัสผ่านไม่ถูกต้องเกิน 3 ครั้ง", 0, "Answer"
         End
      End If
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
        Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
        Command1.SetFocus
End If
End Sub
